import presetWeapp from 'unocss-preset-weapp';
import { transformerClass } from 'unocss-preset-weapp/transformer';

export default {
  presets: [presetWeapp()],
  rules: [
    ['c-primary', { color: '#F4AF22' }],
    ['bg-primary', { 'background-color': '#F4AF22' }],
    [
      /^text-maxline-(\d+)$/,
      ([, d]) => ({
        'text-overflow': 'ellipsis',
        '-webkit-line-clamp': d,
        '-webkit-box-orient': 'vertical',
        'word-break': 'break-all',
        'overflow': 'hidden',
        'display': '-webkit-box',
      }),
    ],
    [
      /^bottom-wrap-(\d+)$/,
      ([, d]) => ({
        'position': 'fixed',
        'bottom': '0',
        'width': '100%',
        'z-index': '999',
        'padding-top': '10rpx',
        'padding-bottom': `${d}rpx`,
        'padding-bottom': `calc( ${d}rpx + constant(safe-area-inset-bottom))`,
        'padding-bottom': `calc( ${d}rpx + env(safe-area-inset-bottom))`,
      }),
    ],
    [
      'btn-primary',
      { 
        'padding-top': '14rpx',
        'padding-bottom': '14rpx',
        'background-color': '#F4AF22',
        'border-radius': '10rpx',
        'color': '#fff',
        'font-size': '28rpx',
        'text-align': 'center'
      }
    ],
    [
      'btn-primary_plain',
      { 
        'padding-top': '14rpx',
        'padding-bottom': '14rpx',
        'border': '2rpx solid #F4AF22',
        'border-radius': '10rpx',
        'color': '#F4AF22',
        'font-size': '28rpx',
        'text-align': 'center'
      }
    ]
  ],
  transformers: [transformerClass()],
};
